package com.coder.chen.slidingmenu.adapter;

import com.coder.chen.slidingmenu.R;
import com.coder.chen.slidingmenu.domain.SampleItem;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class SampleAdapter extends ArrayAdapter<SampleItem>{

	public SampleAdapter(Context context) {
		super(context,0);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null){
			convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_row, null);
		}
		
		ImageView icon = (ImageView) convertView.findViewById(R.id.iv_item_row_icon);
		icon.setImageResource(getItem(position).iconRes);
		
		TextView title = (TextView) convertView.findViewById(R.id.tv_item_row_title);
		title.setText(getItem(position).tag);

		return convertView;
	}
	
}
